<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title></title>
</head>
<body>
<h2>Hello World!</h2>

<p1>登陆</p1>

<table id="from-login">
    <tr>
        <td>username</td>
        <td><input id="username"/></td>
    </tr>
    <tr>
        <td>password</td>
        <td><input id="password" type="password"/></td>
    </tr>
    <tr>
        <td><input type="button" value="登陆" id="btn-login"/></td>
        <td><p id="test"></p></td>
    </tr>
</table>

</body>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script>
    $('#btn-login').click(function(){
        $.ajax({
            url:"/problem/user/login",
            type:"POST",
            dataType:"json",
            /*async:false,
            contentType:"application/json;charset=utf-8",*/
            data:
                {
                    "username":$('#username').val(),
                    "password":$('#password').val()
                }
            ,
            success:function(message){
                $('#test').text(JSON.stringify(message.status))
            },
            error:function(message){
                $('#test').text("fail to post");
            }
        });
    });
</script>
</html>